<?php
namespace app\controller;
use app\BaseController;
use think\facade\Db;
use think\facade\Filesystem;

class up extends BaseController
{
    public function index()
    {
        $imgs = Db::name('imgs')->select();
        return view('index',['imgs'=>$imgs]);
    }

    public function save()
    {
        $files = request()->file('image');
        foreach($files as $file){
            $saveName = Filesystem::disk('public')->putFile('', $file);
            Db::name('imgs')->insert(['path' => $saveName]);

        }
        return redirect('index');
    }
}